package com.ahm.service;

import com.ahm.pojo.Product;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author anhaimeng
 * @title: ProductServiceImpl
 * @projectName feign-demo
 * @description: TODO
 * @date 2021/10/1917:38
 */
/*功能描述
 * @author ahm
 */
@Service
public class ProductServiceImpl implements ProductService {



    @Override
    public List<Product> selectAllProduct() {
        return Arrays.asList(
                new Product(1,"xiaomi",22,23.0D),
                new Product(2,"qq",22,23.0D),
                new Product(3,"huawei",22,23.0D)
        );
    }


    @Override
    public Product selectById(Integer id) {
        return  new Product(id,"xiaomi",11,23.0D);
    }

    @Override
    public Map<String, Object> saveProduct(Product product) {
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("code","200");
        hashMap.put("msg","添加成功");
        hashMap.put("data",product);
        return hashMap;
    }

    @Override
    public Product getProduct(Product product) {
        return product;
    }

}
